﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SampleWeb
{
	public partial class About : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{

			var keyList = new List<string>();
			foreach (string key in Session.Keys)
				keyList.Add(key);
			
			this.rptSessionItems.DataSource = (from k in keyList
												select new { Key=k, Value=Session[k] }
												);
			this.rptSessionItems.DataBind();
		}

		protected void cmdClearSession_Click(object sender, EventArgs e)
		{
			this.Context.Session.Abandon();
		}

		protected void cmdAdd_Click(object sender, EventArgs e)
		{
			this.Context.Session[this.txtKey.Text] = this.txtValue.Text;
			Response.Redirect(Request.RawUrl);
		}
	}
}
